<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/styleold.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
</head>

<body>
    <div id="list">

        <div class="user-t">
            <div class="user-t-t">
                <!--             <div id="avatar" class="user-t-t-l" tapmode onclick="user_data()" style="display: none">
                <img src="image/gril.jpg">
                Deandean
            </div> -->
                <div id="is_login" class="aui-col-xs-3 user-t-r" tapmode onclick="login();" style="display: none">登录</div>
                <div class="user-t-t-r" tapmode onclick="message()">
                    <i>0</i>
                    <img src="image/user-t-t-r.png">
                </div>
            </div>
            <dl tapmode onclick="user_assets()">
                <dt>总资产（元）</dt>
                <dd>00.00</dd>
            </dl>
            <ul>
                <li tapmode onclick="user_dqcc()">
                    <p>当前持仓（元）</p>
                    0
                </li>
                <li tapmode onclick="user_profit()">
                    <p>累计收益（元）</p>
                    00.00
                </li>
            </ul>
        </div>
        <div class="user-tx">
            <div class="user-tx-l">
                可用余额（元）
                <p>00.00</p>
            </div>
            <button tapmode onclick="sh_bank_recharge()">充值</button>
            <button tapmode onclick="sh_bank_withdraw()">提现</button>
        </div>
        <ul class="user-1">
            <li tapmode onclick="red_packet_list()">
                0
                <p>红包</p>
            </li>
            <li tapmode onclick="coupon_list();">
                0
                <p>加息券</p>
            </li>

        </ul>
        <ul class="aui-list aui-list-in user-list">
            <li class="aui-list-item aui-list-item-middle">
                <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="my_repay_plan()">
                    <div class="aui-list-item-title"><img src="image/user-1.png">回款计划</div>
                </div>
            </li>
            <!-- <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="zhitou_list()">
                <div class="aui-list-item-title"><img src="image/user-2.png" style="margin-top:0.05rem">我的随意享</div>
            </div>
        </li> -->
            <li class="aui-list-item">
                <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="my_fund()">
                    <div class="aui-list-item-title"><img src="image/user-2.png" style="margin-top:0.05rem">资金统计</div>
                </div>
            </li>

            <li class="aui-list-item">
                <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="zqzr()">
                    <div class="aui-list-item-title"><img src="image/user-3.png" style="margin-top:0.05rem">债权转让</div>
                </div>
            </li>
        </ul>

    </div>
    <!-- <div class="foot-t"></div>
<ul class="foot">
    <li tapmode>
        <img src="image/foot-1.png" tapmode onclick="index()">
        <p onclick="index()">首页</p>
    </li>
    <li tapmode>
        <img src="image/foot-2.png" tapmode onclick="licai_hqlc()">
        <p onclick="licai_hqlc()">理财</p>
    </li>
    <li class="active" tapmode>
        <img src="image/foot-3-h.png" tapmode onclick="user()">
        <p onclick="user()">我的</p>
    </li>
    <li tapmode>
        <img src="image/foot-4.png" tapmode onclick="more()">
        <p onclick="more()">更多</p>
    </li>
</ul> -->

</body>
<script type="text/template" id="template">
    <div class="user-t">
        <div class="user-t-t">
            <div id="avatar" class="user-t-t-l" tapmode onclick="user_data()">
                <img src="image/jkd.jpg" id="headImg"> {{=it.user_name}}
            </div>
            <!-- <div id="is_login" class="aui-col-xs-3 user-t-r" tapmode onclick="login();" style="display: none">登录</div> -->
            <div class="user-t-t-r" tapmode onclick="message()">
                <div id='messageNub'>
                    {{? it.unread == 0}} {{??}}
                    <i>{{=it.unread}}</i> {{?}}
                </div>
                <img src="image/user-t-t-r.png">
            </div>
        </div>
        {{? it.is_hrb == '1'}}
        <dl tapmode onclick="user_assets()">
            <dt>总资产（元）</dt>
            <dd>{{=it.total_money}}</dd>
        </dl>
        <ul>
            <li tapmode onclick="user_dqcc()">
                <p>当前持仓（元）</p>
                {{=it.lock_money}}
            </li>
            <li tapmode onclick="user_profit()">
                <p>累计收益（元）</p>
                {{=it.total_rate_money}}
            </li>
        </ul>
    </div>
    <div class="user-tx">
        <div class="user-tx-l">
            可用余额（元）
            <p>{{=it.money}}</p>
        </div>
        <button tapmode onclick="sh_bank_recharge()">充值</button>
        <button tapmode onclick="sh_bank_withdraw()">提现</button>
    </div>
    <ul class="user-1">
        <li tapmode onclick="red_packet_list()">
            {{=it.ecv}}
            <p>红包</p>
        </li>
        <li tapmode onclick="coupon_list();">
            {{=it.jxq}}
            <p>加息券</p>
        </li>
        <!-- <li tapmode onclick="money();">
            {{? it.learn_money}}
            {{=it.learn_money}}
            {{??}}
            0
            {{?}}
            <p>体验金(元)</p>
        </li> -->
    </ul>
    <ul class="aui-list aui-list-in user-list">
        <li class="aui-list-item aui-list-item-middle">
            <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="my_repay_plan()">
                <div class="aui-list-item-title"><img src="image/user-1.png">回款计划</div>
            </div>
        </li>
        <!-- <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="zhitou_list()">
                <div class="aui-list-item-title"><img src="image/user-2.png" style="margin-top:0.05rem">我的随意享</div>
            </div>
        </li> -->
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="my_fund()">
                <div class="aui-list-item-title"><img src="image/user-4.png" style="margin-top:0.05rem">资金统计</div>
            </div>
        </li>

        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="zqzr()">
                <div class="aui-list-item-title"><img src="image/user-3.png" style="margin-top:0.05rem">债权转让</div>
            </div>
        </li>
    </ul>
    {{?? }}
    <div class="user-kt">
        <button tapmode onclick="openBank();">点击开通鄂托克存管系统</button>
    </div>
    {{?}}

</script>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    apiready = function() {

        var userid = $api.getStorage('userid');
        if (userid) {
            $('#is_login').css('display', 'none');
            $('#avatar').css('display', 'block');

            updateData();
        } else {
            $('#is_login').css('display', 'block');
            $('#avatar').css('display', 'none');
        }

    }

    // 更新数据,模板函数
    function updateData() {
        // 进度提示框
        api.showProgress({
            title: '努力加载中...',
            text: '请稍等...',
            modal: false
        });
        var userid = $api.getStorage('userid');
        // 如果已登录 获取数据
        if (userid) {
            api.ajax({
                url: webAddress + '/index.php?ctl=app_user_center2&act=userinfo',
                method: 'post',
                data: {
                    values: {
                        id: userid,
                    },
                }
            }, function(ret, err) {
                if (ret) {
                    // 关闭下拉刷新控件
                    api.refreshHeaderLoadDone();
                    api.hideProgress();
                    if (ret.status == 0) {
                        alert(ret.info);
                        return false;
                    } else {
                        var deviceId = api.deviceId;

                        if (deviceId != ret.user.device_code) {
                            alert('您的手机已在其他设备登录 请从新登录！');
                            logout();
                            return;
                        }

                        // alert(JSON.stringify(ret));s

                        var data = ret.user;
                        // 用户昵称
                        var user_name = ret.user.user_name;
                        $api.setStorage('user_name', user_name);
                        // 用户手机号
                        var mobile = ret.user.mobile;
                        // 用户手机号,密文
                        $api.setStorage('mobileM', mobile);
                        var is_hrb = ret.user.is_hrb;
                        // 大鹏licai-zhitou页面刷新
                        sendMsg();
                        $api.setStorage('is_hrb', is_hrb);
                        // 总资产
                        var total_money = outputmoney(ret.user.total_money);
                        data.total_money = total_money;
                        $api.setStorage('total_money', total_money);
                        // 可用余额
                        var money = outputmoney(ret.user.money);
                        data.money = money;
                        $api.setStorage('money', money);
                        // // 冻结资金(待收本金)
                        // var lock_money = outputmoney(ret.user.lock_money);
                        // data.lock_money = lock_money;
                        // 已获收益
                        var load_pay_earnings = outputmoney(ret.user.load_pay_earnings);
                        data.load_pay_earnings = load_pay_earnings;
                        // 待获收益
                        var load_wait_earnings = outputmoney(ret.user.load_wait_earnings);
                        data.load_wait_earnings = load_wait_earnings;
                        $api.setStorage('load_wait_earnings', load_wait_earnings);

                        // 累计收益
                        var total_rate_money = outputmoney(ret.user.total_rate_money);
                        data.total_rate_money = total_rate_money;
                        $api.setStorage('total_rate_money', total_rate_money);

                        // 是否设置交易密码
                        var isset_paypassword = ret.user.isset_paypassword;
                        $api.setStorage('isset_paypassword', isset_paypassword);

                        // 比率
                        var per_total = ret.user.per_total;
                        $api.setStorage('per_total', per_total);

                        // 当前持仓
                        var lock_money = outputmoney(ret.user.lock_money);
                        data.lock_money = lock_money;
                        $api.setStorage('lock_money', lock_money);

                        // 红包数量
                        var ecv = ret.user.ecv;
                        $api.setStorage('ecv', ecv);
                        // 加息券数量
                        var jxq = ret.user.jxq;
                        $api.setStorage('jxq', jxq);
                        // 用户积分
                        var score = ret.user.score;
                        $api.setStorage('score', score);
                        var path = ret.user.avatar;
                        // userInfo数据
                        // 调用模板函数
                        templateFun(data, path);

                        var learn_list = ret.user.learn_list;
                        // 如果有体验金
                        if (learn_list) {
                            for (var i = 0; i < learn_list.length; i++) {
                                var learn_list_id = learn_list[i].id;
                                var learn_list_money = learn_list[i].money;
                                api.ajax({
                                    url: webAddress + '/index.php?ctl=app_user_center&act=get_ecv',
                                    method: 'post',
                                    data: {
                                        values: {
                                            id: userid,
                                            ecv_id: learn_list_id,
                                            table: '1',
                                        },
                                    }
                                }, function(ret, err) {
                                    if (ret) {
                                        api.openWin({
                                            name: 'tiyanjin-detail',
                                            url: './tiyanjin-detail.html',
                                            pageParam: {
                                                learn_list_money: learn_list_money
                                            }
                                        });
                                    } else {
                                        alert(err.msg);
                                    }
                                });
                                return false;
                            }

                        }

                        var ecv_list = ret.user.ecv_list;
                        // 如果有红包
                        if (ecv_list) {
                            for (var i = 0; i < ecv_list.length; i++) {
                                var ecv_type_id = ecv_list[i].ecv_type_id;
                                var ecv_id = ecv_list[i].id;
                                // alert(ecv_id);
                                api.ajax({
                                    url: webAddress + '/index.php?ctl=app_user_center&act=get_ecv',
                                    method: 'post',
                                    data: {
                                        values: {
                                            id: userid,
                                            ecv_id: ecv_id
                                        },
                                    }
                                }, function(ret, err) {
                                    if (ret) {
                                        // alert( JSON.stringify( ret ) );
                                        // console.log( JSON.stringify( ret ));
                                        // api.openWin({
                                        //     name: 'hongbao',
                                        //     url: './hongbao.html',
                                        //     pageParam: {
                                        //         ecv_type_id: ecv_type_id
                                        //     }
                                        // });
                                    } else {
                                        alert(JSON.stringify(err));
                                    }
                                });
                                return false;
                            }
                        }
                    }
                } else {
                    alert(err.msg);
                    // 关闭下拉刷新控件
                    api.refreshHeaderLoadDone();
                    // 关闭加载状态控件
                    api.hideProgress();
                }
            });
        } else {
            // 关闭下拉刷新控件
            api.refreshHeaderLoadDone();
            // 关闭加载状态控件
            api.hideProgress();
            templateFun();
        }
    };

    // 打开登录
    function login() {

        api.openWin({
            name: 'login',
            url: './login.html',
            pageParam: {
                name: 'test'
            }
        });
    }

    // 模板赋值函数
    function templateFun(data, path) {

        var template = $api.byId('template');
        var dotFn = doT.template(template.innerHTML);
        var html = dotFn(data);
        var user = $api.byId('list');
        $api.html(user, html);

        if (path != "") {
            var p = webAddress + path;
            $("#headImg").attr('src', p);
        }
    }

    function index() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'index',
            url: './index.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function licai_hqlc() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'licai_hqlc',
            url: './licai_hqlc.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function more() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'more',
            url: './more.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    // 用户详细信息中心
    function user_data() {

        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        } else {
            api.openWin({
                name: 'user_data',
                url: './user_data.html',
                bounces: false,
                delay: delay,
                slidBackEnabled: true,
                vScrollBarEnabled: false,
                progress: {
                    type: "page"
                }
            });
        }
        //     var is_hrb = $api.getStorage('is_hrb');
        //
        //     if (is_hrb && is_hrb!='undefined') {
        //         api.openWin({
        //             name: 'user_data',
        //             url: './user_data.html',
        //             bounces: false,
        //             delay: delay,
        //             slidBackEnabled: true,
        //             vScrollBarEnabled: false,
        //             progress: {
        //                 type: "page"
        //             }
        //         });
        //     }else{
        //         alert('请先开通银行账户!');
        //         openBank();
        //     }
    };

    // 回款计划
    function my_repay_plan() {

        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');

            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        // api.openWin({
        //     name: 'my_repay_plan',
        //     url: './my-repay-plan.html',
        //     bounces: false,
        //     delay: delay,
        //     slidBackEnabled: true,
        //     vScrollBarEnabled: false,
        //     progress: {
        //         type: "page"
        //     }
        // });

        api.openWin({
            name: 'toubiao',
            url: './toubiao.html',
            // pageParam: {
            //     name: 'test'
            // }
        });
    };

    // 我的智投(我的随意享)
    function zhitou_list() {

        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        api.openWin({
            name: 'zhitou-list',
            url: './zhitou-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    function message() {


        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'message',
            url: './message.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            reload: true,
            progress: {
                type: "page"
            }
        });
    };

    function user_assets() {
        // 总资产
        var total_money = $api.getStorage('total_money');
        // 当前持仓(待收收益 待定)
        var lock_money = $api.getStorage('lock_money');
        // 可用余额
        var money = $api.getStorage('money');
        // 占用比例
        var per_total = $api.getStorage('per_total');
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'user_assets',
            url: './user_assets.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            },
            pageParam: {
                total_money: total_money,
                lock_money: lock_money,
                money: money,
                per_total: per_total,
            }
        });

    };

    function user_dqcc() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        // api.openWin({
        //     name: 'user_dqcc',
        //     url: './user_dqcc.html',
        //     bounces:false,
        //     delay: delay,
        //     slidBackEnabled:true,
        //     vScrollBarEnabled:false,
        //     progress:{
        //         type:"page"
        //     }
        // });
        api.openWin({
            name: 'loan_list',
            url: './loan-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function user_profit() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'user_profit',
            url: './user_profit.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function closeWin() {


        api.closeWin({});
    }

    // 登录成功发送刷新请求
    function sendMsg() {
        api.sendEvent({
            name: 'login_success',
            extra: {
                key1: 'value1',
                key2: 'value2'
            }
        });
    }

    // 红包列表
    function red_packet_list() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        api.openWin({
            name: 'red_packet_list',
            url: './red-packet-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    // 加息券列表
    function coupon_list() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        api.openWin({
            name: 'coupon_list',
            url: './coupon-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    // 体验金列表
    function money() {

        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        api.openWin({
            name: 'money',
            url: './money.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    // 充值
    function sh_bank_recharge() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        api.openFrame({
            name: 'recharge-top',
            url: './recharge-top.html',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: '70px',
            },
            pageParam: {
                name: 'test'
            },
            bounces: false,
            bgColor: 'rgba(0,0,0,0)',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });

        api.openFrame({
            name: 'sh_bank_recharge',
            url: './sh-bank-recharge.html',
            rect: {
                x: 0,
                y: '70px',
                w: 'auto',
                h: 'auto'
            },
            pageParam: {
                name: 'test'
            },
            bounces: false,
            bgColor: 'rgba(0,0,0,0)',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });
    };

    // 提现
    function sh_bank_withdraw() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }


        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        // var topbarWithdraw = document.getElementById("topbarWithdraw");
        // topbarWithdraw.style.display='inline-block';
        // $('#topbarWithdraw').show();
        // $api.fixStatusBar($api.dom('#topbarWithdraw'));
        // var headerPos = $api.offset($api.dom('#topbarWithdraw'));

        api.openFrame({
            name: 'withdraw-top',
            url: './withdraw-top.html',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: '70px',
            },
            pageParam: {
                name: 'test'
            },
            bounces: false,
            bgColor: 'rgba(0,0,0,0)',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });

        api.openFrame({
            name: 'sh_bank_withdraw',
            url: './sh-bank-withdraw.html',
            rect: {
                x: 0,
                y: '70px',
                w: 'auto',
                h: 'auto'
            },
            pageParam: {
                name: 'test'
            },
            bounces: false,
            bgColor: 'rgba(0,0,0,0)',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });
    };

    function closeBottomFrame() {

        api.closeFrame({
            name: 'sh_bank_recharge'
        });
        api.closeFrame({
            name: 'sh_bank_withdraw'
        });
        api.closeFrame({
            name: 'bank'
        });
        api.closeFrame({
            name: 'recharge-top'
        });
        api.closeFrame({
            name: 'withdraw-top'
        });

    };

    // 资金统计
    function my_fund() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        api.openWin({
            name: 'my_fund',
            url: './my-fund.html',
            pageParam: {
                name: 'test'
            }
        });
    };

    // 开通银行
    function openBank() {

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }

        api.openFrame({
            name: 'open-bank',
            url: './open-bank.html',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: '70px',
            },
            pageParam: {
                backUrl: 'user'
            },
            bounces: false,
            bgColor: 'rgba(0,0,0,0)',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });

        api.openFrame({
            name: 'bank',
            url: './bank.html',
            rect: {
                x: 0,
                y: '70px',
                w: 'auto',
                h: 'auto'
            },
            pageParam: {
                backUrl: 'user'
            },
            bounces: false,
            bgColor: 'rgba(0,0,0,0)',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });

    }


    function logout() {
        var userid = $api.getStorage('userid');

        $api.setStorage('registrationId', null);

        $api.setStorage('userid', '');
        $api.setStorage('mobile', '');
        // 提示退出成功
        api.toast({
            msg: '退出成功!',
            duration: 1500,
            location: 'middle'
        });
        var setSele = 'randomSwitchBtn(0);';
        api.execScript({
            name: 'root',
            script: setSele,
        });

        // api.ajax({
        //     url: webAddress + '/index.php?ctl=app_user_center2&act=set_apns_code',
        //     method: 'post',
        //     data: {
        //         values: {
        //             apns_code: null,
        //             id: userid
        //         }
        //     }
        // }, function(ret, err) {
        //     // alert( JSON.stringify( ret ) );
        //     $api.setStorage('userid', '');
        //     $api.setStorage('mobile', '');
        //     // 提示退出成功
        //     api.toast({
        //         msg: '退出成功!',
        //         duration: 1500,
        //         location: 'middle'
        //     });
        //     var setSele = 'randomSwitchBtn(0);';
        //     api.execScript({
        //         name: 'root',
        //         script: setSele,
        //     });
        // });
    }

    function zqzr() {
      var delay = 0;
      if (api.systemType != 'ios') {
          // delay = 300;
      }

      var userid = $api.getStorage('userid');
      if (!userid) {
          alert('请先登录');
          api.openWin({
              name: 'login',
              url: './login.html',
              pageParam: {
                  name: 'test'
              }
          });
          return false;
      }

      api.openWin({
          name: 'user_claims_list',
          url: './user_claims_list.html',
          pageParam: {
              name: 'test'
          }
      });
    }
</script>

</html>
